<div id="divMain"><input id="duongdan" type="hidden" value="<?=base_url('untitled/getDDL/idCL/update/')?>" /><input id="duongdans" type="hidden" value="<?=base_url('untitled/getDDL/idLP/')?>" /><?=form_open(base_url("untitled/sanpham/sua.html"))?>
    <?php foreach($result as $item) { echo form_hidden("id", $item->id); ?><input type="hidden" id="idLP_hidden" value="<?=$item->idLP?>" /><input type="hidden" id="idL_hidden" value="<?=$item->idL?>" />
	<table align="center" class="tblUpdate">
        <tr>
            <td>Hình sản phẩm:</td>
            <td align="left">
            	<div style="float:left;text-align:center;padding:5px"><?php if($this->files->checkfile('./upload/sanpham/'.$item->id.'/'.$item->hinh1)) { ?><?=anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=1'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Sửa");?> - <?=anchor(base_url('untitled/xoahinh.html?id='.$item->id.'&thutu=1&loai=sanpham&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Xóa");?><br /><img src="<?=base_url('upload/sanpham/'.$item->id.'/'.$item->hinh1)?>" width="100" /> <?php } else { echo anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=1'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Thêm hình chính");}?></div>
                <div style="float:left;text-align:center;padding:5px"><?php if($this->files->checkfile('./upload/sanpham/'.$item->id.'/'.$item->hinh2)) { ?><?=anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=2'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Sửa")?> - <?=anchor(base_url('untitled/xoahinh.html?id='.$item->id.'&thutu=2&loai=sanpham&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Xóa");?><br /><img src="<?=base_url('upload/sanpham/'.$item->id.'/'.$item->hinh2)?>" width="100" /> <?php } else { echo anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=2'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING'])," | Thêm hình phụ");}?></div>
                 <div style="float:left;text-align:center;padding:5px"><?php if($this->files->checkfile('./upload/sanpham/'.$item->id.'/'.$item->hinh3)) { ?><?=anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=3'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Sửa")?> - <?=anchor(base_url('untitled/xoahinh.html?id='.$item->id.'&thutu=3&loai=sanpham&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Xóa");?><br /><img src="<?=base_url('upload/sanpham/'.$item->id.'/'.$item->hinh3)?>" width="100" /><?php } else { echo anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=3'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING'])," | Thêm hình phụ");}?></div>
                <div style="float:left;text-align:center;padding:5px"><?php if($this->files->checkfile('./upload/sanpham/'.$item->id.'/'.$item->hinh4)) { ?><?=anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=4'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Sửa")?> - <?=anchor(base_url('untitled/xoahinh.html?id='.$item->id.'&thutu=4&loai=sanpham&url='.current_url().'?'.$_SERVER['QUERY_STRING']),"Xóa");?><br /><img src="<?=base_url('upload/sanpham/'.$item->id.'/'.$item->hinh4)?>" width="100" /><?php } else { echo anchor(base_url('untitled/upload.html?folder=upload/sanpham/'.$item->id.'&hinh=4'.'&loai=1&id='.$item->id.'&url='.current_url().'?'.$_SERVER['QUERY_STRING'])," | Thêm hình phụ");}?></div>
            </td>
        </tr>
    	<tr>
        	<td>Chủng loại:<?=form_error('idCL')?></td>
            <td style="text-align:left">
            	<select id="idCL" name="idCL">
                <?php foreach($resultDDL as $items) { ?><option value="<?=$items->id?>" <?=($item->idCL==$items->id)?'selected="selected"':''?>><?=$items->ten?></option><?php } ?>
                </select>
            </td>
        </tr>
    	<tr>
        	<td>Loại phòng:<?=form_error('idLP')?></td>
            <td style="text-align:left">
            	<select id="idLP" name="idLP"></select>
            </td>
        </tr>
    	<tr>
        	<td>Loại sản phẩm:<?=form_error('idL')?></td>
            <td style="text-align:left">
            	<select id="idL" name="idL"></select>
            </td>
        </tr>
    	<tr>
        	<td>Nổi bật:<?=form_error('noibat')?></td>
            <td style="text-align:left"><select name="noibat"><option value="1" <?=($item->noibat==1)?'selected="selected"':''?>>Có</option><option <?=($item->noibat==0)?'selected="selected"':''?> value="0">Không</option></select></td>
        </tr>
        <tr>
        	<td>Ẩn hiện:<?=form_error('anhien')?></td>
            <td align="left"><select name="anhien"><option <?=($item->anhien==1)?"selected='selected'":""?> value="1">Hiện</option><option <?=($item->anhien==0)?"selected='selected'":""?> value="0">Ẩn</option></select></td>
        </tr>
    	<tr>
        	<td>Tên:<?=form_error('ten')?></td>
            <td style="text-align:left"><input type="text" name="ten" value="<?=$item->ten?>" /></td>
        </tr>
        <tr>
        	<td>Giá:<?=form_error('gia')?></td>
            <td style="text-align:left"><input type="text" name="gia" value="<?=$item->gia?>" /></td>
        </tr>
    	<tr>
        	<td>Thứ tự:<?=form_error('thutu')?></td>
            <td style="text-align:left"><input type="text" name="thutu" value="<?=$item->thutu?>" /></td>
        </tr>
        <tr>
        	<td valign="top">Nội dung:<?=form_error('noidung')?></td>
            <td style="text-align:left"><?php $arr=array('value'=>$item->noidung); $this->editor->create($arr);?></td>
        </tr>
        <tr>
        	<td colspan="2"><?=form_submit("btnSubmit","Sửa")?></td>
        </tr>
    </table>
    <?php } ?>
    <?=form_close();?>
</div>